package com.jy.adscm.operation.mscyb.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.jy.adscm.operation.mscyb.bean.JqbzSettings;
import com.jy.adscm.operation.mscyb.bean.JqzzPartsMaterial;
import com.jy.adscm.operation.mscyb.mapper.mysql.JqbzSettingsMapper;
import com.jy.adscm.operation.mscyb.mapper.mysql.JqzzPartsMaterialMapper;
import com.jy.adscm.operation.mscyb.service.JqzzPartsMaterialService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zyl
 * @since 2019-06-02
 */
@Service
public class JqzzPartsMaterialServiceImpl extends ServiceImpl<JqzzPartsMaterialMapper, JqzzPartsMaterial> implements JqzzPartsMaterialService {
    @Autowired
    JqbzSettingsMapper jqbzSettingsMapper;
    @Override
    public List<JqzzPartsMaterial> selectByTid(String tid) {
        Wrapper<JqzzPartsMaterial> wrapper =new EntityWrapper<>();
        wrapper.eq("tid",tid);
        List<JqzzPartsMaterial> jqzzPartsMaterials = super.selectList(wrapper);
        for (JqzzPartsMaterial jqzzPartsMaterial : jqzzPartsMaterials) {
            JqbzSettings jqbzSettings = jqbzSettingsMapper.selectById(jqzzPartsMaterial.getName());
            jqzzPartsMaterial.setNameName(jqbzSettings.getName());

        }
        return jqzzPartsMaterials;
    }
}
